/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import request from '../utils/request';

const time = new Date().getTime();
function requestApi(run, params = '', url = '/Api/Handle/run', method = 'POST') {
  return request(url, {
    method,
    body: {
      data: JSON.stringify({
        data: params,
        run,
        time,
      }),
    },
  });
}
// 获取最近一月资金流水
export async function getAccountList(params) {
  return requestApi('/FundsAccount/latestFlow', params);
}

// 获取账户余额与支付宝账号
export async function getAccountInfo(params) {
  return requestApi('/FundsAccount/accountBalance', params);
}

// 充值
export async function rechargePay(params) {
  return requestApi('/FundsAccount/charging', params);
}

// 充值回调
export async function rechargeCallBack(params) {
  return requestApi('/FundsAccount/chargingCheck', params);
}

// 提现
export async function getCash(params) {
  return requestApi('/FundsAccount/withdraw', params);
}

// 获取验证码
export async function getSmsCode(params) {
  return requestApi('/FundsAccount/bind', params);
}

// 绑定提现账号
export async function bindAccount(params) {
  return requestApi('/FundsAccount/bind', params);
}

// 获取资金流水详细
export async function getAccountDetail(params) {
  return requestApi('/FundsAccount/capitalFlow2', params);
}

// 获取资金交易类型
export async function getTypeOptions(params) {
  return requestApi('/FundsAccount/transType2', params);
}

// 获取账号权限列表
export async function getAccounts(params) {
  return requestApi('/Platform/index', params);
}

// 添加账号
export async function addAccount(params) {
  return requestApi('/Platform/addShopInfo', params);
}

// 删除账号
export async function deleteAccount(params) {
  return requestApi('/Platform/delete', params);
}

// 修改
export async function updateAccount(params) {
  return requestApi('/Api/Account/update', params);
}

// 分配角色
export async function assignRole(params) {
  return requestApi('/Platform/privilege', params);
}

// 切换开启禁用状态
export async function switchStatus(params) {
  return requestApi('/Platform/multiForbidden', params);
}

// 获取共配费用明细
export async function getFeeDetail(params) {
  return request('/v1/TotalDistribution/GpFinanceDetails/getFinanceDetailsList', {
    method: 'POST',
    body: params,
  });
}

// 获取共配费用明细，明细导出
export async function exportDetail(params) {
  return request('/v1/TotalDistribution/GpFinanceDetails/getFinanceDetailsByDate', {
    method: 'POST',
    body: params,
  });
}

// 资金账户，账户余额，转入消费账户
export async function transformMoney(params) {
  return request('/v1/TotalDistribution/GpFinanceDetails/transform', {
    method: 'POST',
    body: params,
  });
}
// 资金账户，账户余额，修改余额预警
export async function editBalanceWarningInfo(params) {
  return request('/Api/Company/editBalanceWarning', {
    method: 'POST',
    body: params,
  });
}
// 资金账户，账户余额，获取余额预警信息
export async function getBalanceWarningInfo(params) {
  return request('/Api/Company/shopBalanceWarningInfo', {
    method: 'POST',
    body: params,
  });
}
// 转账到可消费账户
export async function transformToConsumer(params) {
  return requestApi('/FundsAccount/changeWithdrawToAvail', params);
}
/**
 * 账号管理，给子账号分配片区
 *  */
export async function dispatchArea(params) {
  return request('/Api/Site/divideAreaPower', {
    method: 'POST',
    body: params,
  });
}
